// mypage/accRealname/accRealname.js


Page({
  /*页面的初始数据*/
  data: {
    imgs:[
      {text:"人像面照片",url:"",bg:'https://ossdev0.jiabala.com/AXAMNFMekzY3C'},
      {text:"国徽面照片",url:"",bg:'https://ossdev0.jiabala.com/WQXriesiX7WZ7'}
    ],
    img1:'',
    img2:'',
    show_btn:false
  },
  /*生命周期函数--监听页面加载*/
  onLoad: function (options) {

  },
  choose_img:function(e){
    var that = this,imgs=that.data.imgs;
    var index = e.currentTarget.dataset.index;
    wx.chooseImage({
      count: 1,
      sourceType: ['album', 'camera'],
      complete: (res) => {
        imgs[index].url=res.tempFilePaths[0];
        that.setData({imgs:imgs});
        if(index==0){
          that.setData({img1:res.tempFilePaths[0]})
        }else{
          that.setData({img2:res.tempFilePaths[0]})
        }
        //
        that.change_btn();
      },
    })
  },
  change_btn:function(){
    var that=this,img1=that.data.img1,img2=that.data.img2;
    if(img1&&img2){
      that.setData({show_btn: true})
    }
  },
  confirm_img:function(){
    var that = this,show_btn=that.data.show_btn;
    if(show_btn){

    }else{
      wx.showToast({
        title: '请先上传证件照',
        icon: 'none',
        duration: 2000
      })
    }
  }
})